﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WI_E2_Parser
{
    class resultHolder
    {
        public string pageName;
        public List<KeyValuePair<Term, double>> wtResult = new List<KeyValuePair<Term,double>>();
        public double score = 0;

        public List<KeyValuePair<Term, double>> getNormalizedList()
        {
            List<KeyValuePair<Term, double>> rtnList = new List<KeyValuePair<Term,double>>();

            double pageWTTemp = 0;
            
            foreach(KeyValuePair<Term, double> wt in wtResult)
            {
                pageWTTemp += Math.Pow(wt.Value, 2);        
            }

            pageWTTemp = Math.Sqrt(pageWTTemp);

            foreach (KeyValuePair<Term, double> wt in wtResult)
            {
                rtnList.Add(new KeyValuePair<Term, double>(wt.Key, wt.Value / pageWTTemp));
            }

            return rtnList;
        }
        
    }
}
